Image encoding method

ABSTRACT

The invention concerns a method for encoding a digitised image comprising several pixel lines, which consists in encoding one line with a series of sub-codes characteristic of the length of the successive fields and their colour. The invention is characterised in that when the image comprises several identical successive lines, it consists in encoding the first of said lines and in completing with a sub-code characterising the repetition of the line and the number of times the line is repeated following said first line; when the image comprises several lines including the same succession of colours, it consists in encoding the first of said lines and in completing said code with a succession of sub-codes characterising the repetition of the succession of colours and the length of different fields of the different lines.

Presentation of the General Technical Domain and of the State of the Art

[0001] The present invention relates to an image coding method.

[0002] It advantageously finds application in particular in respect of the coding of images of limited size (width and height of the order of or less than 400 pixels, for example), and more especially in respect of the coding and compression of simple images to be displayed on small-size screens (screens of portable telephones or of any other handheld terminal), such as advertising images comprising logos or alphanumeric characters with a particular design, or else stylized representations (commercial designs, images of the type of those known as “clipart”).

[0003] It is in fact desired, in particular for the applications described in the applicant's French patent application filed under number FR-00.683, to be able to transmit and display images of the aforesaid type on screens of handheld terminals, such as portable telephones or pocket computers of the type of those marketed by the company 3COM under the name “Palm” or of the type of those using the Windows CE operating system and marketed by the companies CASIO and COMPAQ under the respective names “Cassiopeia” and “Aero”.

[0004] An aim of the invention is therefore to propose a method for the coding and compression of images allowing high graphical fidelity, and in particular good rendition of the logos and of the design specific to advertisers and moreover allowing transmission using a limited number of bytes per image (400/500 useful bytes per image, for example).

[0005] Numerous coding and compression techniques are already known.

[0006] A coding and compression system which comes close to the expressed requirements is the “Bitmap Compuserve GIF” which is in particular used greatly on the Internet.

[0007] Reference may be made in this regard to patent U.S. Pat. No. 4,558,302 from Unisys Corporation “LZW (Lempel-Zev-Welch) compression and decompression methods”.

[0008] This system codes the images with 2, 3, 4, 8 bits per pixel depending on the nature of the image.

[0009] However, its performance proves to be no better than a conventional statistical code and it is especially ineffective for simple images for which, given the level of rendition desired, it requires vector processing.

Presentation of the Invention

[0010] The solution proposed by the invention, the performance of which proves to be markedly better, is a method for coding a digitized image comprising several lines of pixels, according to which method a line is coded by a succession of subcodes characteristic of the length of the successive fields and of their color, characterized in that

[0011] when the image comprises several identical successive lines, the first of these lines is coded and this code is supplemented with a subcode characteristic of the repetition of the line and of the number of times that the line is repeated subsequent to this first line,

[0012] when the image comprises several lines comprising the same succession of colors, the first of these lines is coded and this code is supplemented with a succession of subcodes which is characteristic of the repetition of the succession of colors and of the length of the various fields of the various lines.

[0013] Such a method is advantageously supplemented with the following various characteristics taken alone or according to all their possible combinations:

[0014] the code of a line which is not identical to the previous line or which does not comprise the same succession of colors comprises successively for each color field a subcode characteristic of the color of said field and a subcode characteristic of the length of the field;

[0015] a color is coded on fifteen values;

[0016] if the length of the field is less than 15 pixels, the field is coded on a byte XY, where X is the hexadecimal index number of the color and Y the length likewise in hexadecimal of the field and if the length of the field is greater than 15 pixels, the field is coded on two bytes X0, ZY where X is the index number of the color of the field and ZY the length of the field;

[0017] when the image comprises several identical successive lines, if the number of lines to be reproduced which are identical to the last line coded is less than 15, the repetition code is coded on one byte; and if this number is greater than 15, the repetition code is split into two bytes, one characteristic of the repetition function, the other which codes the number of lines to be reproduced;

[0018] when a line possesses the same structure of fields as the previous one, the length of its fields is coded in the following manner: if the length of a field is less than 15 pixels, its length is coded on a half-byte and, if the length of a field is greater than 15 pixels, its length is coded on three half-bytes 0, ZY where ZY is the length of the field;

[0019] a statistical compression processing is implemented on the coded image;

[0020] the images are of width and height dimensions of the order of or less than 400 pixels and are coded on a number of bytes of the order of or less than 500.

[0021] The invention also relates to a method characterized in that the coding method of the aforesaid type is implemented on a plurality of images and in that the images thus coded are broadcast in a loop to at least one handheld terminal which decodes the coded images which it receives so as to display them on its screen.

[0022] It relates furthermore to a system for broadcasting data in a loop comprising means for the radio broadcasting of data blocks in a given zone, a plurality of handheld terminals able to receive the data blocks thus radiobroadcast, processing means which manage the broadcasting of said data, characterized in that said processing means and said handheld terminals implement a method of the aforesaid type.

[0023] Other characteristics and advantages of the invention will become more apparent from the description which follows, which is purely illustrative and nonlimiting.

[0024] Description of at Least One Mode of Implementation of the Invention

[0025] A first step of a possible mode of implementation of the invention consists of a preprocessing of the image which is aimed at eliminating the intermediate colors allocated to the pixels during the digitization of an analog image and limits the number of colors to be transmitted while improving the appearance of the image. It may be supplemented with manual touching-up limited to a few pixels.

[0026] A coding on the current lines of the image is implemented next, with the use of the correlation between successive lines to reduce the size of the code.

[0027] Lastly, a final statistical compression is implemented making it possible to utilize the statistical structure of the image.

[0028] Description of the Coding

[0029] The coding is carried out on fifteen colors.

[0030] The code used to describe an image comprises two parts, juxtaposed in the final file, that is to say after compression:

[0031] the header describing the general characteristics of the coded image (type of statistical compression, size of the header, size of the image, color palette),

[0032] the code of the image proper which makes it possible to reconstruct the color of each of the pixels, once the header is known.

[0033] The Header

[0034] The header comprises a variable number of bytes dependent on the number of colors comprising the image to be coded (maximum of 15).

[0035] More exactly, this number of bytes is equal to 3 times the number of colors to be coded plus four.

[0036] The assignment of the various bytes of the header is given by table 3.1, where B_(i) denotes the ith byte. TABLE 3.1 Rank of the byte Assignment Field/meaning B₀ Type of statistical B0 = 80 + k (80 for compression and version 1.0) version (82, 83, 84, 88) B₁ Shifting data, rank (7-46) of the first byte of the image code B₂ Width of the image (1-240) (pixels) B₃ Height of the image (1-255) (pixels) B₄ to B₆ RGB* of color 0 (1-255) B₇ to B₉ RGB of color 1 (1-255) . . . . . . . . . B_(3N+1) to B_(3(N+1)) RGB of color N (1-255) . . . . . . . . .

[0037] Coding of the Image Proper

[0038] The coding of the image is performed line by line or by packets of identical lines commencing at the top left of the image and terminating at the bottom right.

[0039] Three types of coding are used for the lines depending on whether:

[0040] the current line is identical to the previous one (coding of repetitive lines),

[0041] the current line is similar to the previous one in that it comprises the same sequence of color fields, but with different field lengths (coding of lines of like structure),

[0042] the current line is original in the sense that it does not belong to the above two categories (standard coding of a line).

[0043] The first line of an image is always coded in standard mode.

[0044] Standard Coding of a Line

[0045] The code gives successively for each color field of the line the color index number coded from 0 to 14 (the value 15 is reserved for the “flags” tagging certain functionalities) and the length of the field.

[0046] if the length of the field is less than 15 pixels (same remark as hereinabove for the value 15), the field is coded XY hex. on one byte where X is the hexadecimal index number of the color and Y the length likewise in hexadecimal of the field (X≦E, 1≦Y≦E), E representing the number 14 in hexadecimal (E hex.=14 dec.) likewise F hex.=15 dec.;

[0047] if the length of the field is greater than 15 pixels, the field is coded on two bytes X0, ZY where X is the index number of the color of the field (X≦E) and ZY the length of the field.

[0048] Coding of Repetitive Lines

[0049] When the coder has detected that a line is identical to the one preceding it, or that a series of lines is identical to the last line coded, it does not describe the fields of these lines and limits itself to sending a repetition code.

[0050] if the number of lines to be reproduced which are identical to the last line coded is less than 15, the repetition code is one byte of the form FW where W≦E is the number of lines which are identical to the previous one that the decoder must reproduce, FW being the repetition code associated with W;

[0051] if this number is greater than 15, the same escape procedure is used as for the coding of the fields; the repetition “flag” takes the form F0 followed by a byte which codes the number of lines to be reproduced TW (01≦TW≦FE).

[0052] Coding of Lines of Like Structure

[0053] If a line possesses the same structure of fields as the previous one (same number, same colors in the same order), it is not necessary to transmit the colors again since the structure in the previous line can be copied.

[0054] The coding of a line of this nature is signaled by the FF “flag”; the lengths of fields are coded in the following manner:

[0055] if the length of the field is less than 15 pixels, the field length is coded Y on a half-byte (Y≦E),

[0056] if the length of the field is greater than 15 pixels, the field is coded on three half-bytes 0, Z, Y where ZY is the length of the field.

[0057] The series of half-bytes is then reassembled into bytes with the possible addition of a padding half-byte at the end of the line if the coding leads to an odd number of half-bytes.

[0058] Statistical Compression

[0059] The codes corresponding to the various lines are assembled sequentially to give the code of the complete image.

[0060] However, this code does not take account of the statistics introduced by the structure of the image. The aim of the statistical compressor is to best utilize this distribution under conditions tailored to the limited size of the code.

[0061] Under the principle adopted the code distributes the bytes into two classes:

[0062] the most frequent bytes which are encoded on 2, 3 or 4 bits preceded by a bit set to 0, i.e. words of 3, 4 and 5 bits respectively,

[0063] the least frequent bytes are transmitted in full and preceded by a bit set to 1, i.e. 9 bits in total.

[0064] The choice to be made between the various compression solutions is made by the coder after having calculated the total size of the resulting code. The latter selects the most effective mode out of the four possible solutions. This choice is registered in the parameter k which can be accessed from the first byte of the header (table 3.2). A priori the statistical compression is not implemented for pre-compression image code sizes below an adjustable threshold (20 bytes as a typical value). TABLE 3.2 No statistical compression K = 8 Compression on 2 bits K = 2 Compression on 3 bits K = 3 Compression on 4 bits K = 4

[0065] The first 2^(k) bytes of the compressed image code constitute the lookup table for the correspondence between the reduced code on k bits and the compressed bytes. The first byte being coded 0, the next 1, the last 2^(k)−1 ([11], [111] or [1111] in binary).

[0066] The rest of the compressed image code is constructed as follows:

[0067] 1) a series of words of k+1 or 9 bits is constructed, each representing one of the bytes of the code before compression according to the following rule:

[0068] if the byte appears in the table of most frequent bytes with rank n, it is coded by the binary word formed by 0 followed by the k-bit binary expression for n (example the byte with rank 5 from the 0, 1 . . . 7 bytes of the table (k=3) is coded [0101],

[0069] if the byte does not appear in this table, it is coded by the binary word formed by 1 followed by the unchanged binary code of the byte in question (example the byte 242 which does not appear in the table is coded [111110010]).

[0070] 2) the series of thus-constructed words is then compacted into bytes. If the total length of the string of words is not a multiple of 8, a padding word is added to the end of the string to make the string up to a multiple of 8. This padding word consists of a one followed by as many zeros as necessary. Insofar as the total length of this word is less than or equal to 7 and insofar as it begins with a 1 which customarily signals a 9-bit word, it is easily recognized and eliminated by the decoder.

[0071] The final code is then assembled by stringing the following components together:

[0072] 1) if k=8 (no statistical compression) stringing together of the header and of the uncompressed image code

[0073] 2) if k=2, 3 or 4, stringing together of the header, of the sequence of the most frequent bytes and of the compressed image code.

[0074] Other Characteristics

[0075] In case of errors leading to the impossibility of decoding the image, the decoder returns a default image consisting of a rectangle with the dimensions of the image and in the “0” color, insofar as it is capable of reading the first few bytes of the header.

[0076] The method used also allows the production of transparencies (“inlay”) by rendering the background of the image transparent. To produce a transparency, the coder allocates the transparent fields an immediately higher color index number than the last color described in the header. This leads to the number of colors actually available for the image being reduced to 14.

[0077] It will have been understood, the coding processing just described and the decoding processing are dissymmetric, the coding requiring more power than the decoding, this being especially relevant for the type of applications envisaged.

[0078] The decoding implemented by the means of processing of the handheld terminals is inverse to the coding processing and allows restoral of the image on a terminal equipped with the Windows CE software, for dimensions of images of the type of those indicated earlier (images of 255×255 pixels, for example, or 240×320 pixels).

[0079] The processing proposed allows not only the coding of images comprising logos or alphanumeric characters with a particular design, or stylized representations (commercial designs, images of type those known by the name “clipart”).

[0080] In the case of more complex images, and in particular of images of photographic type, use will be made of conventional solutions (“JPEG” processing) with slicing of the image into strips whose coding requires fewer than 500 bytes.

[0081] The coding method proposed finds application advantageously in the case of images broadcast in a loop, if appropriate with other elements, to at least one handheld terminal which decodes the coded images which it receives so as to display them on its screen.

[0082] In particular, this coding method is advantageously implemented by the means of processing of a system for broadcasting data in a loop to handheld terminals.

[0083] Such a system is for example that which has been described in patent application FR-00.683.

[0084] It comprises in particular means for the radio broadcasting of data blocks in a given zone, a plurality of handheld terminals able to receive the data blocks thus radiobroadcast, processing means which manage the broadcasting of said data.

[0085] Said handheld terminals then carry a program which allows them to decode the coded images which it receives so as (if appropriate) to display them on its screen. 

1. A method for coding a digitized image comprising several lines of pixels, according to which method a line is coded by a succession of subcodes characteristic of the length of the successive fields and of their color, characterized in that when the image comprises several identical successive lines, the first of these lines is coded and this code is supplemented with a subcode characteristic of the repetition of the line and of the number of times that the line is repeated subsequent to this first line, when the image comprises several lines comprising the same succession of colors, the first of these lines is coded and this code is supplemented with a succession of subcodes which is characteristic of the repetition of the succession of colors and of the length of the various fields of the various lines.
 2. The method as claimed in claim 1, characterized in that the code of a line which is not identical to the previous line or which does not comprise the same succession of colors comprises successively for each color field a subcode characteristic of the color of said field and a subcode characteristic of the length of the field.
 3. The method as claimed in claim 2, characterized in that a color is coded on fifteen values.
 4. The method as claimed in either of claims 2 and 3, characterized in that if the length of the field is less than 15 pixels, the field is coded on a byte XY, where X is the hexadecimal index number of the color and Y the length likewise in hexadecimal of the field, if the length of the field is greater than 15 pixels, the field is coded on two bytes X0, ZY where X is the index number of the color of the field and ZY the length of the field.
 5. The method as claimed in one of the preceding claims, characterized in that, when the image comprises several identical successive lines, if the number of lines to be reproduced which are identical to the last line coded is less than 15, the repetition code is coded on one byte; if this number is greater than 15, the repetition code is split into two bytes, one characteristic of the repetition function, the other which codes the number of lines to be reproduced.
 6. The method as claimed in one of the preceding claims, characterized in that when a line possesses the same structure of fields as the previous one, the length of its fields is coded in the following manner: if the length of a field is less than 15 pixels, its length is coded on a half-byte, if the length of a field is greater than 15 pixels, its length is coded on three half-bytes 0, ZY where ZY is the length of the field.
 7. The method as claimed in one of the preceding claims, characterized in that a statistical compression processing is implemented on the coded image.
 8. The method as claimed in one of the preceding claims, characterized in that the images are of width and height dimensions of the order of or less than 400 pixels and are coded on a number of bytes of the order of or less than
 500. 9. A method characterized in that the coding method as claimed in one of the preceding claims is implemented on a plurality of images and in that the images thus coded are broadcast in a loop to at least one handheld terminal which decodes the coded images which it receives so as to display them on its screen.
 10. A system for broadcasting data in a loop comprising means for the radio broadcasting of data blocks in a given zone, a plurality of handheld terminals able to receive the data blocks thus radiobroadcast, processing means which manage the broadcasting of said data, characterized in that said processing means and said handheld terminals implement a method as claimed in claim
 9. 